import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from "typeorm";
import { QualityType } from "../consts/quality_type";
import { Player } from "./player.entity";

@Entity("treasure")
export class Treasure{

    @PrimaryGeneratedColumn()
    id: number;

    @Column()
    qualityType:QualityType;

    @Column()
    level:number;

    @ManyToOne(()=>Player, { onDelete: 'CASCADE',lazy: true })
    player:Promise<Player>|Player;


    init(qualityType:QualityType,player:Player){
        this.qualityType=qualityType;
        // this.player=Promise.resolve(player);
        this.level=player.level;
    }



}